<?php
/**
 * Generate Attachements File and return a preview
 * directly in the browser
 * 
 * @author Xavier VILAIN
 * @package Orx\Mailer
 * 
 */
use Orx\Mailer\MailBox\Message\Attachement;
$xview = Xview::instance();

$inlineId = $xview->val('inlineid');
try {
	$attachement = Fox\Dao::load(Attachement::className(), $inlineId);
	$attachement->preview();
} catch(Fox\Object\Exception\NotExist $e) {
	Fox\Message::Error($e);
	$xview->redirectBack();
	exit;
}
catch(Exception $e) {
	Fox\Message::Error($e);
	$xview->redirectBack();
	exit;
}